using System.Diagnostics.Contracts;

namespace Beaker.Services.FileSystem
{
	[ContractClass( typeof( FileSystemEntryContracts ) )]
	public interface IFileSystemEntry
	{
		/// <summary>
		/// Gets the name of the entry
		/// </summary>
		string Name { get; }

		/// <summary>
		/// Get the folder this entry is in
		/// </summary>
		IFolder ParentFolder { get; }

		/// <summary>
		/// Convert the file to fs-entry string, but it might be local to the IFileSystemService
		/// </summary>
		/// <returns></returns>
		string ToString();
	}

	[ContractClassFor( typeof( IFileSystemEntry ) )]
	public abstract class FileSystemEntryContracts
		: IFileSystemEntry
	{
		#region Implementation of IFileSystemEntry

		/// <summary>
		/// Gets the name of the entry
		/// </summary>
		public string Name
		{
			get
			{
				Contract.Ensures( Contract.Result<string>() != null );
				throw new System.NotImplementedException();
			}
		}

		/// <summary>
		/// Get the folder this entry is in
		/// </summary>
		public IFolder ParentFolder
		{
			get
			{
				// result can be null, so no contract
				throw new System.NotImplementedException();
			}
		}

		#endregion
	}
}